home *** CD-ROM | disk | FTP | other *** search
/ Developer CD Series 2000 November: Tool Chest / Dev.CD Nov 00 TC Disk 1.toast / Sample Code / Networking / PGPuam / headers / AppleShare.h < prev    next >
Encoding:
C/C++ Source or Header  |  2000-09-28  |  12.9 KB  |  360 lines  |  [TEXT/MPS ]

  1. /*
  2.      File:        AppleShare.h
  3.  
  4.      Contains:    Public Header file for the AppleShare Client API (AFP Protocol)
  5.  
  6.      Version:    3.7
  7.  
  8.      DRI:        Leland Wallace
  9.  
  10.      Copyright:    © 1997 by Apple Computer, Inc., all rights reserved.
  11.  
  12.      Warning:    *** APPLE INTERNAL USE ONLY ***
  13.                  This file may contain unreleased API's
  14.  
  15.      BuildInfo:    Built by:            Leland Wallace
  16.                  With Interfacer:    3.0d3   (PowerPC native)
  17.                  From:                AppleShare.i
  18.                      Revision:        4
  19.                      Dated:            2/03/98
  20.                      Last change by:    law
  21.                      Last comment:    • Moved the SMB insert/remove calls into the public header.
  22.  
  23.      Bugs:        Report bugs to Radar component "System Interfaces", "Latest"
  24.                  List the version information (from above) in the Problem Description.
  25.  
  26. */
  27. #ifndef __APPLESHARE__
  28. #define __APPLESHARE__
  29.  
  30. #ifndef __CONDITIONALMACROS__
  31. #include <ConditionalMacros.h>
  32. #endif
  33. #ifndef __MIXEDMODE__
  34. #include <MixedMode.h>
  35. #endif
  36. #ifndef __DEVICES__
  37. #include <Devices.h>
  38. #endif
  39. #ifndef __APPLETALK__
  40. #include <AppleTalk.h>
  41. #endif
  42. #ifndef __OPENTRANSPORT__
  43. #include <OpenTransport.h>
  44. #endif
  45. #ifndef __OPENTPTINTERNET__
  46. #include <OpenTptInternet.h>
  47. #endif
  48. #ifndef __OPENTPTAPPLETALK__
  49. #include <OpenTptAppleTalk.h>
  50. #endif
  51.  
  52.  
  53.  
  54. #if PRAGMA_ONCE
  55. #pragma once
  56. #endif
  57.  
  58. #ifdef __cplusplus
  59. extern "C" {
  60. #endif
  61.  
  62. #if PRAGMA_IMPORT
  63. #pragma import on
  64. #endif
  65.  
  66. #if PRAGMA_STRUCT_ALIGN
  67.     #pragma options align=mac68k
  68. #elif PRAGMA_STRUCT_PACKPUSH
  69.     #pragma pack(push, 2)
  70. #elif PRAGMA_STRUCT_PACK
  71.     #pragma pack(2)
  72. #endif
  73.  
  74.  
  75.  
  76. /*    -------------------------------------------------------------------------
  77.     csCodes
  78.     ------------------------------------------------------------------------- */
  79. /* for PBControl calls*/
  80.  
  81. enum {
  82.     afpGetAttnRoutine            = 252,                            /*    Get the default AFP Attention routine*/
  83.     dsOpenSession                = 244,                            /*    Open an AFP session to the server*/
  84.     dsGetStatus                    = 243,                            /*    Send a GetSrvrInfo request to the server*/
  85.     dsSendRequest                = 240,                            /*    Send an AFP command to the server*/
  86.     dsCloseSession                = 237,                            /*    Close the specified session*/
  87.     dsCloseAll                    = 232,                            /*    Close all sessions*/
  88.                                                                 /* these will not be needed after Client 3.8    */
  89.     AFPInsSessMemBlk            = 246,                            /* insert the SMB into the drviers Queue    */
  90.     AFPRemSessMemBlk            = 245                            /* remove the SMB from the drviers Queue    */
  91. };
  92.  
  93. /* for PBStatus calls*/
  94.  
  95. enum {
  96.     afpGetFSID                    = 127,                            /*    returns the File System ID    */
  97.     afpSVolInfo                    = 124,                            /*     returns basic info about the server volume (address, servername, username...)*/
  98.     afpXGetVolInfo                = 121,                            /*    returns extended info about the volume (server time offset, volume grade...)*/
  99.     dsGetXPortInfo                = 236                            /*    returns information about the transport used for the given session*/
  100. };
  101.  
  102. /*    -------------------------------------------------------------------------
  103.     Data Stream Parameter Block
  104.     ------------------------------------------------------------------------- */
  105. typedef CALLBACK_API( void , DSIOCompletionProcPtr )(void *pb);
  106. /*
  107.     WARNING: DSIOCompletionProcPtr uses register based parameters under classic 68k
  108.              and cannot be written in a high-level language without 
  109.              the help of mixed mode or assembly glue.
  110. */
  111. typedef REGISTER_UPP_TYPE(DSIOCompletionProcPtr)                 DSIOCompletionUPP;
  112.  
  113.  
  114. /* csCode = dsSendRequest*/
  115. struct DSWritePB {
  116.     UInt32                             dsWriteDataOffset;            /* <- specifies the write offset in the data*/
  117.     UInt32                             dsWriteBufferSize;            /* <- size of the data to be written*/
  118.     Byte *                            dsWriteBuffer;                /* <- ptr to data to be written*/
  119. };
  120. typedef struct DSWritePB DSWritePB;
  121.  
  122. /* csCode = dsGetStatus*/
  123. struct DSGetStatusPB {
  124.     OTAddress *                        dsGSSrvrAddress;            /* <- OT Address of server to GetStatus() from (you also need to fill in the reply buffer & size)*/
  125.     const char *                    dsGSEpString;                /* <- endpoint string for the connection (nil == default)        */
  126. };
  127. typedef struct DSGetStatusPB DSGetStatusPB;
  128.  
  129. /* csCode = dsOpenSession*/
  130. struct DSOpenPB {
  131.     AttnRoutineUPP                     dsOSAttnRoutine;            /* <- Custom attention routine (nil == default)*/
  132.     OTAddress *                        dsOSSrvrAddress;            /* <- OT Address of server to open a session to*/
  133.     Ptr                             dsOSSessionBlock;            /* <- ptr to the SMB; memory reserved for the session.*/
  134.     const char *                    dsOSEpString;                /* <- endpoint string for the connection (nil == default)        */
  135. };
  136. typedef struct DSOpenPB DSOpenPB;
  137.  
  138.  
  139. enum {
  140.     SMBSize                        = 2560                            /* size of the session memory block*/
  141. };
  142.  
  143.  
  144. struct DSParamBlock {
  145.     QElem *                            qLink;                        /* - standard header stuff*/
  146.     short                             qType;                        /* - standard header stuff*/
  147.     short                             ioTrap;                        /* - standard header stuff*/
  148.     Ptr                             ioCmdAddr;                    /* - standard header stuff*/
  149.     DSIOCompletionUPP                 ioCompletion;                /* <- completion rtn point*/
  150.     OSErr                             ioResult;                    /* -> result from Async call*/
  151.     long                             cmdResult;                    /* -> result from the Server for the AFP Cmd*/
  152.     short                             ioVRefNum;                    /* - standard header stuff */
  153.     short                             ioCRefNum;                    /* <- RefNum of the ".AFPTranslator"*/
  154.     short                             csCode;                        /* <- DS Command code*/
  155.     short                             dsTimeout;                    /* <- ASP - How long to wait before retrying request, TCP - resv for internal use*/
  156.     short                             dsReserved1;                /* -  resv for internal use*/
  157.     long                             dsRetry;                    /* <- ASP - How many times to retry the request, TCP - unused*/
  158.     UInt16                             dsReserved2;                /* -  resv for internal use*/
  159.     short                             dsSessRefNum;                /* <- AFP Session number*/
  160.     short                             dsReserved3;                /* -  resv for internal use*/
  161.     short                             dsCmdBufferSize;            /* <- size of the command buffer*/
  162.     UInt8 *                            dsCmdBuffer;                /* <- ptr to the command buffer*/
  163.     UInt32                             dsReplyBufferSize;            /* <- size of the reply buffer*/
  164.     UInt8 *                            dsReplyBuffer;                /* <- ptr to the reply buffer*/
  165.  
  166.     union {
  167.         DSOpenPB                         open;
  168.         DSWritePB                         write;
  169.         DSGetStatusPB                     status;
  170.     }                                 csParam;
  171. };
  172. typedef struct DSParamBlock DSParamBlock;
  173.  
  174. typedef DSParamBlock *                    DSParamBlockPtr;
  175. struct DSXPortInfo {
  176.     long                             dsXPortType;                /* Transport Type (kASPXport, kTCPXport)*/
  177.     short                             dsXPortSessRefNum;            /* Session ref number for ASP or TCP*/
  178.     union {
  179.         InetAddress                     ipAddr;
  180.         DDPAddress                         ddpAddr;
  181.     }                                 addr;
  182. };
  183. typedef struct DSXPortInfo DSXPortInfo;
  184.  
  185. typedef DSXPortInfo *                    DSXPortInfoPtr;
  186. /* definitions for     dsXPortType */
  187.  
  188. enum {
  189.     kASPXport                    = 0x00,
  190.     kTCPXport                    = 0x01
  191. };
  192.  
  193.  
  194. struct GetVolSessInfoRec {
  195.     short                             sessAFPVersion;                /*    AFP version number: */
  196.     short                             sessReferenceNumber;        /*    AFP session reference number*/
  197.     short                             sessAFPVolID;                /*    AFP volume identifier*/
  198.     OTAddress *                        sessServerAddress;            /*    server internet address*/
  199.     short                             sessUAMType;                /*    user authentication method*/
  200.     StringPtr                         sessUserNamePtr;            /*    ptr to user name string*/
  201.     Ptr                             sessVolIconPtr;                /*    ptr to server volume icon/mask*/
  202.     StringPtr                         sessWhereStringPtr;            /*    ptr to "where" information string, shown in the Get Info window*/
  203. };
  204. typedef struct GetVolSessInfoRec GetVolSessInfoRec;
  205.  
  206. typedef GetVolSessInfoRec *                GetVolSessInfoRecPtr;
  207.  
  208. enum {
  209.     kAFPVersion11                = 1,
  210.     kAFPVersion20                = 2,
  211.     kAFPVersion21                = 3,
  212.     kAFPVersion22                = 4
  213. };
  214.  
  215.  
  216. enum {
  217.     kNoUserAuth                    = 1,                            /*    'No User Authent' UAM (Guest)*/
  218.     kCleartextAuth                = 2,                            /*    'Cleartxt Passwrd' UAM     (types 2 & 3 will be automatically upgraded to 6)*/
  219.     kRandnumAuth                = 3,                            /*    'Randnum Exchange' UAM */
  220.     k2WayRandnumAuth            = 6,                            /*    '2-Way Randnum exchange' */
  221.     kMinCustomUAM                = 128                            /*    Minimum type value for a Custom UAM*/
  222. };
  223.  
  224. struct GetVolSessInfoPB {
  225.     QElemPtr                         qLink;                        /*  -  standard header stuff*/
  226.     short                             qType;                        /*  -  standard header stuff*/
  227.     short                             ioTrap;                        /*  -  standard header stuff*/
  228.     Ptr                             ioCmdAddr;                    /*  -  standard header stuff*/
  229.     IOCompletionUPP                 ioCompletion;                /* <-  completion rtn pointer*/
  230.     OSErr                             ioResult;                    /*  -> result from Async call*/
  231.     StringPtr                         ioNamePtr;                    /*  -  standard header stuff*/
  232.     short                             ioVRefNum;                    /*  -  standard header stuff*/
  233.     short                             ioRefNum;                    /* <-  RefNum of the ".AFPTranslator"*/
  234.     short                             csCode;                        /* <-  allways afpSVolInfo*/
  235.     Ptr                             vcbPtr;                        /* <-  pointer to the VCB that you want info about*/
  236.     GetVolSessInfoRecPtr             sessInfoBuffer;                /* <-  pointer to the GetVolSessInfoRec to be filled*/
  237.     long                             sessInfoSize;                /* <-  size of the GetVolSessInfoRec*/
  238.     long                             actSessInfoSize;            /*  -> actual size of the data returned*/
  239. };
  240. typedef struct GetVolSessInfoPB GetVolSessInfoPB;
  241.  
  242. typedef GetVolSessInfoPB *                GetVolSessInfoPBPtr;
  243. /* the AFPInsSessMemBlk & AFPRemSessMemBlk  calls are currently (pre Client 3.8) required
  244.    when opening or closing a session. Make the AFPInsSessMemBlk call after the dsOpenSession
  245.    call succeeds (or returns afpAuthContinue), with the same dsOSSessionBlock that you
  246.    sent into dsOpenSession. You need to call AFPRemSessMemBlk with that same pointer after
  247.    calling dsCloseSession or dsCloseAll. In Client 3.8 these will be called for you
  248.    during the dsOpenSession & dsCloseSession calls.
  249. */
  250. struct AFPInsRemSMBParam {
  251.     QElemPtr                         qLink;                        /*  -  standard header stuff    */
  252.     short                             qType;                        /*  -  standard header stuff    */
  253.     short                             ioTrap;                        /*  -  standard header stuff    */
  254.     Ptr                             ioCmdAddr;                    /*  -  standard header stuff    */
  255.     IOCompletionUPP                 ioCompletion;                /* <-  completion rtn pointer    */
  256.     OSErr                             ioResult;                    /*  -> result from Async call    */
  257.     StringPtr                         ioNamePtr;                    /*  -  standard header stuff    */
  258.     short                             ioVRefNum;                    /*  -  standard header stuff    */
  259.     short                             ioRefNum;                    /* <-  RefNum of the ".AFPTranslator"            */
  260.     short                             csCode;                        /* <-  AFPInsSessMemBlk or AFPRemSessMemBlk     */
  261.     Ptr                             smbPtr;                        /* <-> pointer to the SMB to insert or remove    */
  262. };
  263. typedef struct AFPInsRemSMBParam AFPInsRemSMBParam;
  264.  
  265. typedef AFPInsRemSMBParam *                AFPInsRemSMBPBPtr;
  266. /* Server Info Buffer returned from the dsGetStatus call     */
  267. /* you should make your buffer at least 1024 bytes in size.    */
  268. /* a partial definition of the AFPSrvrInfo data structure (the fixed portion) */
  269. struct AFPSrvrInfo {
  270.     short                             fMachineOffset;
  271.     short                             fVerCountOffset;
  272.     short                             fUAMCountOffset;
  273.     short                             fIconOffset;
  274.     short                             fFlags;
  275.     unsigned char                     fSrvrName[2];
  276. };
  277. typedef struct AFPSrvrInfo AFPSrvrInfo;
  278.  
  279. /* definitions for the fFlags word    */
  280.  
  281. enum {
  282.     srvSCopyFile                = 0,                            /* Server supports FPCopyFile call*/
  283.     srvSChangePswd                = 1,                            /* Server supports FPChangePassword call*/
  284.     srvNoPswdSave                = 2,                            /* Workstation should not save password*/
  285.     srvSServerMsgs                = 3,                            /* Server supports server messages*/
  286.     srvSSrvrSig                    = 4,                            /* Server supports Server Signatures  (AFP 2.2)*/
  287.     srvSupportsTCP                = 5,                            /* Server may be connected to via TCP/IP (AFP 2.2)*/
  288.     srvSNotification            = 6                                /* Server will send notifications (AFP 2.2)*/
  289. };
  290.  
  291.  
  292. /* Gestalt selectors & definitions    (will go into gestalt.h soon) */
  293. #if 0
  294. enum {
  295.     gestaltAFPClient            = FOUR_CHAR_CODE('afps'),
  296.     gestaltAFPClientVersionMask    = 0x0000FFFF,                    /* lo word is version*/
  297.     gestaltAFPClient3_5            = 1,
  298.     gestaltAFPClient3_6            = 2,
  299.     gestaltAFPClient3_6_1        = 3,
  300.     gestaltAFPClient3_6_2        = 4,
  301.     gestaltAFPClient3_6_3        = 5,                            /* including 3.6.4, 3.6.5*/
  302.     gestaltAFPClient3_7            = 6,                            /* including 3.7.1*/
  303.     gestaltAFPClient3_7_2        = 7,                            /* including 3.7.3*/
  304.     gestaltAFPClient3_8            = 8,
  305.     gestaltAFPClientCfgMask        = (long)0xFFFF0000,                /* hi word is config*/
  306.     gestaltAFPClientCfgRsrc        = 16,                            /* Client uses config resources*/
  307.     gestaltAFPClientUAMv2        = 28,                            /* Client supports the 2.0 UAM interfaces*/
  308.     gestaltAFPClientSupportsIP    = 29,                            /* Client supports AFP over TCP/IP*/
  309.     gestaltAFPClientVMUI        = 30,                            /* Client can put up UI from the PBVolMount trap*/
  310.     gestaltAFPClientMultiReq    = 31                            /* Client supports multiple outstanding requests*/
  311. };
  312.  
  313. #endif
  314.  
  315.  
  316.  
  317.  
  318.                                                                                             #if TARGET_OS_MAC && TARGET_CPU_68K && !TARGET_RT_MAC_CFM
  319.                                                                                             #pragma parameter __D0 NAFPCommandSync(__A0)
  320.                                                                                             #endif
  321. EXTERN_API( OSErr ) NAFPCommandSync(DSParamBlockPtr paramBlock)                                                                                            ONEWORDINLINE(0xA004);
  322.  
  323.                                                                                             #if TARGET_OS_MAC && TARGET_CPU_68K && !TARGET_RT_MAC_CFM
  324.                                                                                             #pragma parameter __D0 NAFPCommandAsync(__A0)
  325.                                                                                             #endif
  326. EXTERN_API( OSErr ) NAFPCommandAsync(DSParamBlockPtr paramBlock)                                                                                            ONEWORDINLINE(0xA404);
  327.  
  328.  
  329. /* use only for dsCloseAll    */
  330.                                                                                             #if TARGET_OS_MAC && TARGET_CPU_68K && !TARGET_RT_MAC_CFM
  331.                                                                                             #pragma parameter __D0 NAFPCommandImmediate(__A0)
  332.                                                                                             #endif
  333. EXTERN_API( OSErr ) NAFPCommandImmediate(DSParamBlockPtr paramBlock)                                                                                            ONEWORDINLINE(0xA204);
  334.  
  335.  
  336.  
  337.  
  338.  
  339.  
  340. #if PRAGMA_STRUCT_ALIGN
  341.     #pragma options align=reset
  342. #elif PRAGMA_STRUCT_PACKPUSH
  343.     #pragma pack(pop)
  344. #elif PRAGMA_STRUCT_PACK
  345.     #pragma pack()
  346. #endif
  347.  
  348. #ifdef PRAGMA_IMPORT_OFF
  349. #pragma import off
  350. #elif PRAGMA_IMPORT
  351. #pragma import reset
  352. #endif
  353.  
  354. #ifdef __cplusplus
  355. }
  356. #endif
  357.  
  358. #endif /* __APPLESHARE__ */
  359.  
  360.